import request from '@/utils/request';
import { AxiosPromise } from 'axios';

/**
 * 查询测试主列表
 * @param query
 * @returns {*}
 */

export const listExample2 = (query?: example2VO): AxiosPromise<example2VO[]> => {
  return request({
    url: '/demo/example2/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询测试主详细
 * @param id
 */
export const getExample2 = (id: string | number): AxiosPromise<example2VO> => {
  return request({
    url: '/demo/example2/' + id,
    method: 'get'
  });
};

/**
 * 新增测试主
 * @param data
 */
export const addExample2 = (data: example2VO) => {
  return request({
    url: '/demo/example2',
    method: 'post',
    data: data
  });
};

/**
 * 修改测试主
 * @param data
 */
export const updateExample2 = (data: example2VO) => {
  return request({
    url: '/demo/example2',
    method: 'put',
    data: data
  });
};

/**
 * 删除测试主
 * @param id
 */
export const delExample2 = (id: string | number | Array<string | number>) => {
  return request({
    url: '/demo/example2/' + id,
    method: 'delete'
  });
};

/**
 * 查询测试子列表
 * @param query
 * @returns {*}
 */

export const listExample2Line = (query?: example2LineVO): AxiosPromise<example2LineVO[]> => {
  return request({
    url: '/demo/example2/lineList',
    method: 'get',
    params: query
  });
};

/**
 * 删除测试子
 * @param lineId
 */
export const delExample2Line = (lineId: number | undefined) => {
  return request({
    url: '/demo/example2/lineId/' + lineId,
    method: 'delete'
  });
};



export interface example2VO extends BaseEntity,PageQuery {
  /**
   * 主键
   */
  id?: number;

  /**
   * 名称
   */
  name?: string;

  /**
   * 部门id
   */
  deptId?: string | number;

  /**
   * 用户id
   */
  userId?: string | number;

  /**
   * 状态
   */
  status?: string;

  /**
   * 值
   */
  remark?: string;

  /**
   * line列表
   */
  line?: example2LineVO[];

}

export interface example2LineVO {
  /**
   * 父主键
   */
  id?: number;

  /**
   * 子主键
   */
  lineId?: number;

  /**
   * 名称
   */
  name?: string;

  /**
   * 编码
   */
  code?: string;

}
